package com.ssy.lingxi.member.merchant.api.constant;

import com.ssy.lingxi.member.merchant.api.model.response.MapResponse;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lqa
 * @version 2.0.0
 * @date 2022/1/12
 */
public enum BaiDuConfigEnum {
    API_KEY("apiKey", "百度云应用的apikey"),
    SECRET_KEY("secretKey", "百度云应用的secretKey"),
    AES_KEY("aesKey", "百度云应用的aesKey");
    private final String code;
    private final String message;

    BaiDuConfigEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static Boolean getMessage(String code) {
        for (BaiDuConfigEnum e : BaiDuConfigEnum.values()) {
            if (code.equals(e.getCode())) {
                return true;
            }
        }
        return false;
    }

    public static List<MapResponse> getCodes() {
        List<MapResponse> mapResponseList = new ArrayList<>();
        for (BaiDuConfigEnum e : BaiDuConfigEnum.values()) {
            MapResponse mapResponse = new MapResponse();
            mapResponse.setKey(e.getCode());
            mapResponse.setValue(e.getMessage());
            mapResponseList.add(mapResponse);
        }
        return mapResponseList;
    }
}
